<template>
	<view class="content flex-column bg-sub">
		<view class="scroll-y full-width flex-grow" hover-class="none" hover-stop-propagation="false">
			<view class="m-xl bg-white radius-base shadow-lg">
				<view class="p-xl">
					<textarea class="" :maxlength="max" v-model="msg"
						placeholder="使用过程中遇到的问题，希望增加的服务，对应的优化建议，都欢迎您写在这里，感谢您帮助我们做的更好"></textarea>
					<text class="text-grey flex justify-end">{{msg.length}}/{{max}}</text>
				</view>
			</view>
			<button @tap="submit" class="linear-bg mx-xl  text-inverse btn-submit">确认提交</button>
		</view>
	</view>
</template>

<script>
	import {
		SaveFeedBack
	} from '@/api/modules/business';
	export default {
		components: {

		},
		data() {
			return {
				msg: '',
				max: 300
			}
		},
		onLoad() {

		},
		methods: {
			submit() {
				if (this.msg) {
					SaveFeedBack({
						remark: this.msg,
					}).then(res => {
						console.log(res);
						if (res.Code == 200) {
							uni.showToast({
								title: '反馈成功',
								icon: 'none'
							})
							setTimeout(() => {
								uni.navigateBack()
							}, 1500)
						}
					})
					return
				}
				uni.showToast({
					icon: 'none',
					title: '请先输入反馈意见'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn-submit {
		border-radius: $uni-border-radius-base*10;
		margin-top: $uni-spacing-col-base*4;
	}
</style>